package servermain

import (
	"core/db"
	"iotall/iotcore/entity"
	"iotall/iotproxy/server/proxyserver"
)

type ServerMain struct {
}

func (p *ServerMain) Start() {
	var ports = make([]entity.CommPort, 0)

	db.DbMaster.Model(&entity.CommPort{}).Find(&ports)
	for _, v := range ports {
		var createproxy = proxyserver.GetCreateProxy(v.ProxyMode)
		if createproxy != nil {
			var proxy = createproxy.NewServer(&v)
			proxyserver.AddProxyServer(proxy)
			proxy.Start()
		}
	}
}
func (p *ServerMain) Clsoe() {

}
